<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp" %>
<!-- <iframe style=" display: none;width:100%; height:100%;position:absolute; left:0;top:0;z-index:-88888;background: transparent;filter:alpha(opacity=0);  
      -moz-opacity:0;  
      -khtml-opacity:0;  
      opacity:0; " id="DevWinFrame" name="submitFramexs" class="submitFramexs" frameborder="no"> </iframe> -->
<div id="SaveOrUpdateDevWin"
	style="width: 1000px; height: 250px; padding: 10px;overflow-y: auto;"
	class="easyui-dialog" title="查询机动车列表"
	data-options="modal:true,closed:true,minimizable:false,collapsible:false,maximizable:false,iconCls:'icon-save',onClose:function(){$('#saveOrUpdateDevForm')[0].reset();} ">
	<form id="saveOrUpdateDevForm" method="post" enctype="multipart/form-data" >
	    <div data-options="region:'north',border:false" style="height: 88px; position: relative;">
	    				<table cellspacing="0" cellpadding="0" border="0" width="100%" class="dananguanglikuang2">
	    					<!-- <tr>
						     	 <th align="right" height="26" width="80">序号：</th>
									<td align="right" height="20"
										class="tangchukuangliebiao1">
										<input id="xhSelect" style="width: 95%;" type="text" class="shurukuangkais" placeholder="请输入序号" value=""  />
							</tr> -->				  
					     	 <tr>
						     	 <th align="right" height="26">流水号：</th>
									<td align="right" height="20"
										class="tangchukuangliebiao1">
										<input id="lshSelect" style="width: 58%;" type="text" class="shurukuangkais" placeholder="请输入流水号" value=""  /> <!-- placeholder="请输入号牌号码" value="" -->
									</td>
							  <th align="right" height="26" >号牌号码：</th>
							  <td id=xzqhId  align="center" width="30" style="font-weight: bold; color: #777777;"></td>
								<td align="right" class="tangchukuangliebiao1">
									<input id="hpSelect" style="width: 90%;" type="text" class="shurukuangkais"/>
								</td>
								
							</tr>
							<tr>
								<th align="right" height="26">号牌种类：</th>
								<td>
					                 <input type="text" id="hpzlSelection" class="easyui-combobox"
					                        data-options="prompt:'请选择号牌种类',url:'${ctx}/code/findCodeByCodetype.htm?xtlb=00&dmlb=1007',valueField:'dmz',textField:'dmsm1mc',editable:false" style="width: 60%;">
					             </td>
					             <th align="right" height="26"></th>
					             <td align="right" colspan="2"><a href="javascript:queryVehInfo();" class="congzhim" id="shenqingcx"  style="margin: 0 5px 2px 0; bottom:5px;right:12px;">查询</a></td>
							</tr>
				</table>
					
	    		</div>
		<div class="menu_form_body">
			<table name="hphm" border="0" cellpadding="0" cellspacing="0" width="100%" class="cheliangxinxi">
			 <thead>
				 <tr>
				     <th align="center" height="26" >流水号</th>
					 <th align="center" height="26" >号牌号码</th>
					 <th align="center" height="26" >号牌种类</th>
					 <th align="center" height="26">车辆品牌</th>
					 <th align="center" height="26">所有人</th>
					 <th align="center" height="26">车辆识别代号</th>
					 <th align="center" height="26">业务类型</th>
					 <th align="center" height="26">操作</th>
				 </tr>
			 </thead>
			<tbody id="vehicleList"></tbody>			 
			</table>
			<div class="shenqinganniudss" id="dd" style="display:none;">
				<a href="javascript:addTabFunc();" class="sousuocx"  style="padding: 1px 10px; margin: 0 4px 0 0;">进入编辑</a>
			</div>
		</div>
	</form>
	<iframe id="iframe1" src="about:blank" frameBorder="0" marginHeight="0" marginWidth="0" style="position:absolute; visibility:inherit; top:0px;left:0px;width:1000px; height:250px;z-index:-1; filter:alpha(opacity=0);"></iframe>
</div>
<script type="text/javascript">
function ClickXzqhFun(){
	   var obj = document.getElementById('xzqhId');
	   $.ajax({
			type:'POST',
	        url:'${ctx}/user/selectSsbmOfUser.htm',
	        data:{},
	        dataType:'json',
	        success:function(data, textStatus, jqXHR){
	        	if(data.glbm=='340000000400') obj.innerText='皖';        	
	        	else obj.innerText=data.fzjg;
	        }
	   });	  
}

//查询机动车信息
function queryVehInfo(){
	  $("#vehicleList").html("");
      //$('#policeId')[0].checked
      var v_xzqhId = document.getElementById('xzqhId').innerHTML;
	   var xh = $.trim($('#xhSelect').val());
		   var lsh = $.trim($('#lshSelect').val());
		   var hphm=$.trim($('#hpSelect').val().toUpperCase());//号牌号码
		   var hpzl=$.trim($('#hpzlSelection').combobox('getValue'));//号牌种类
		   var reg = /[\u4e00-\u9fa5]/g;//筛选是否有中文
		   hphm = hphm.replace(reg, "");
		   v_xzqhId=v_xzqhId.replace(reg,"");
		   if(lsh=="" && hphm=="" && hpzl==""){
	  			 return;
	  		 }else if (lsh=="" && hphm=="" && hpzl!=""){
	  			 return;
	  		 }else if(lsh!="" || hphm!="" ||hpzl!=""){
			   if(hphm!="")
		  		hphm =v_xzqhId+hphm;
		       $.ajax({
		           type:'post',
		           url:'${ctx}/yxxx/queryVehcileRecode.htm',
		           data:{
		               hphm:hphm,
		               hpzl:hpzl,
		               lsh:lsh,
		               xh:xh
		           },
		           dataType:'json',
		           success:function(data){
		               if(null!=data && data!=''){ 		  
		            	   applyForInfo(data);		            	   
		               }else{
		            	   alert('该机动车不存在，请重新查询');
		               }
		           }
		       });
		   }
}

function applyForInfo(_data){
	//$('#SaveOrUpdateDevWin').window('open');
	//$("#vehicleList").html("");
	var tBodyStr="";
	$.each(_data,function(i,n){
		tBodyStr +="<tr>";
		tBodyStr +="<td align=\"center\" height=\"26\"><span class=\"indexstylelist\" id =\"lshId\">"+n.lsh+"</span></td>";
		tBodyStr +="<td align=\"center\" height=\"26\"><span class=\"indexstylelist\" id =\"hphmmcId\">"+n.hphmmc+"</span></td>";
		tBodyStr +="<td align=\"center\" height=\"26\"><span class=\"indexstylelist\" id =\"hpzlmcId\">"+n.hpzlmc+"</span></td>";
		tBodyStr +="<td align=\"center\" height=\"26\"><span class=\"indexstylelist\" id =\"clpp1Id\">"+n.clpp1+"</span></td>";
		tBodyStr +="<td align=\"center\" height=\"26\"><span class=\"indexstylelist\" id =\"syrId\">"+n.syr+"</span></td>";
		tBodyStr +="<td align=\"center\" height=\"26\"><span class=\"indexstylelist\" id =\"clsbdhId\">"+n.clsbdh+"</span></td>";
		tBodyStr +="<td align=\"center\" height=\"26\"><span class=\"indexstylelist\" id =\"ywmcId\">"+n.ywmc+"</span></td>";
		tBodyStr +="<td id=\"xhId\" style=\"display:none\">"+n.xh+"</td>";
		tBodyStr +="<td id=\"ywlxId\" style=\"display:none\">"+n.ywlx+"</td>";
		tBodyStr +="<td id=\"ywyyId\" style=\"display:none\">"+n.ywyy+"</td>";
		tBodyStr +="<td id=\"hphmId\" style=\"display:none\">"+n.hphm+"</td>";
		tBodyStr +="<td id=\"hpzlId\" style=\"display:none\">"+n.hpzl+"</td>";
		tBodyStr +="<td id=\"glbmId\" style=\"display:none\">"+n.glbm+"</td>";
		tBodyStr +="<td id=\"xzqhId\" style=\"display:none\">"+n.xzqh+"</td>";
		tBodyStr +="<td align=\"center\" height=\"26\"><span class=\"indexstylelist\"><a href=\"#\" name='applyPrint' applyType='01' style=\"color:red\">申请打印</a>&nbsp;&nbsp;<a href=\"#\" name='applyDownload' applyType='02' style=\"color:red\">申请下载</a>&nbsp;&nbsp;<a href=\"#\" name='applyDelete' applyType='03' style=\"color:red\">申请删除</a></span></td>";
		tBodyStr +="</tr>";		
	})
	$("#vehicleList").append(tBodyStr);
	
	$('a[name=applyPrint],a[name=applyDownload],a[name=applyDelete]').unbind('click').bind('click',function(data){
		debugger;
		var $this=$(this);
		var applyType=$this.attr('applyType');//
		var lsh='';//流水号
		var hphm='';//号牌号码
		var hpzl='';//号牌种类
		var ywlx='';
		var xh='';//序号
		var bz='';
		var obj1=$this.parent().parent().parent();
		 obj1.each(function(){
			var tdVal = $(this).children();
			lsh=$.trim(tdVal.eq(0).text());
			ywlx=$.trim(tdVal.eq(6).text());
			xh=$.trim(tdVal.eq(7).text());
			hphm='皖'+$.trim(tdVal.eq(10).text());
			hpzl=$.trim(tdVal.eq(11).text());
		});
		 var message=$this.text();
         if(confirm('确认'+message+'？')){
     	   $.ajax({
                type:'post',
                url:'${ctx}/audit/addAudit.htm',
                data:{
                   lsh:lsh,
                   hphm:hphm,
                   ywlx:ywlx,
                   permissionType:applyType,
                   hpzl:hpzl,
                   bz:bz,
                   xh:xh
                },
                success:function(data){
                   if(data=='00'){
                       alert('申请失败，请稍后再试');
                   }else if(data=='01'){
                       alert('申请成功');
                       queryDataGrid();
                   }else if(data=='02'){
                       alert('该权限已申请成功，不用再次申请');
                   }
                }
             });
        } 
	   });

}

//获取当前行所有的值
function insertFunc(_this){
	var v_lsh="";
	var obj=$(_this).parent().parent();
	obj.each(function(){
		var tdVal = $(this).children();
		 v_lsh=$.trim(tdVal.eq(0).text());
	});	 
	
	
 
}


</script>